<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="../share/taglib.jsp" %>
<%@ include file="../share/isReadOnly.inc" %>
<html>
<head>
<title>编辑新闻</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="/css/vip.css" type="text/css">
<%@ include file="/sks/cms/page/share/validate.inc" %>
<script type="text/javascript" src="/js/jscripts/tiny_mce/tiny_mce.js"></script>
<script type="text/javascript" src="/js/jscripts/tiny_mce/button_style/default.js"></script>
<script language="javascript" type="text/javascript">
<% if (!isReadOnly) { %>
tinyMCE.init(getDefaultButtonStyle("content"));
<% } %>
function checkForm(){
	setTimeout("SendForm()",50);
	return false;
}
function SendForm(){
	if (document.newsForm.title.value==""){
	alert("标题不能为空！");
	return;
	}
    if (document.newsForm.link.value==""){
	alert("链接地址不能为空！");
	return;
	} 
	if(document.newsForm.content.value==""){
	alert("新闻内容不能为空！");
	return;
	}

document.newsForm.submit();
}

function changeStatus(status) {
	if (!status) {
		return;
	}
	if(!confirm('你确定要执行该操作吗？')) {
		return;
	}
	window.location.href = "<%=basePath%>cms/news/newsManage.do?method=changeStatus&newsId=${newsForm.newsId}&status=" + status;
}
</script> 
<html:javascript formName="newsForm"/>
</head>

<body bgcolor="#FFFFFF" text="#000000">
<html:form action="/cms/news/newsManage" method="post" onsubmit="return checkForm();">
<html:hidden property="newsId"/>
<html:hidden property="createTime"/>
<html:hidden property="click"/>
<html:hidden property="createUserId"/>
<html:hidden property="lastUpdateUserId"/>
<html:hidden property="status"/>
<input type="hidden" name="method" value="edit">
  <table width="90%" border="0" cellspacing="2" cellpadding="3" align="center">
    <tr bgcolor="#ffbe26"> 
      <td colspan="2"><strong><font color="#000000">编辑新闻</font></strong></td>
    </tr>
    <c:if test="${canAudit}">
    <tr bgcolor="f5f5f5"> 
      <td colspan="2">
      <c:if test="${newsForm.status eq 'nonePublish'}">
      	<button type="button" onclick="changeStatus('published');">发布</button>
      </c:if>
      <c:if test="${newsForm.status eq 'published'}">
      	<button type="button" onclick="changeStatus('nonePublish');">撤销发布</button>
      	<button type="button" onclick="changeStatus('invalidate');">标识为失效</button>
      </c:if>
      <c:if test="${newsForm.status eq 'invalidate'}">
      	<button type="button" onclick="changeStatus('published');">撤销至发布状态</button>
      	<button type="button" onclick="changeStatus('nonePublish');">撤销至未发布状态</button>
      </c:if>
      </td>
    </tr>
    </c:if>
    <tr bgcolor="f5f5f5"> 
      <td width="25%"> <div align="right">新闻专题</div></td>
      <td width="75%"> <html:select styleId="featureId" property="featureId" disabled="<%=isReadOnly%>">
      		<html:options collection="features" property="featureId" labelProperty="name"/>
      	</html:select>
		</td>
    </tr>
    <tr bgcolor="f5f5f5"> 
      <td><div align="right">新闻状态</div></td>
      <td valign="middle"><bean:message key="info.news.status.${newsForm.status}"/>
      <c:if test="${newsForm.status == 'published'}">
      (${newsForm.publishTime})
      </c:if>
      </td>
    </tr>
    <tr bgcolor="f5f5f5"> 
      <td width="25%"> <div id="title" align="right">新闻标题<font color="#FF0000">*</font></div></td>
      <td width="75%"> <html:text property="title" size="50" maxlength="40" disabled="<%=isReadOnly%>"/><html:errors property="name"/></td>
    </tr>
    <tr bgcolor="f5f5f5"> 
      <td width="25%"> <div align="right">作者</div></td>
      <td width="75%"> <html:text property="writer" size="20" maxlength="30" disabled="<%=isReadOnly%>"/></td>
    </tr>
	<tr bgcolor="f5f5f5"> 
      <td width="25%"> <div align="right">资讯来源</div></td>
      <td width="75%"> <html:text property="source" size="50" maxlength="30" disabled="<%=isReadOnly%>"/></td>
    </tr>
	<tr bgcolor="f5f5f5"> 
      <td width="25%"> <div id="link" align="right">链接<font color="#FF0000">*</font></div></td>
      <td width="75%"> <html:text property="link" size="50" maxlength="300" disabled="<%=isReadOnly%>"/></td>
    </tr>
    <tr bgcolor="f5f5f5"> 
      <td width="25%"> <div align="right">备注</div></td>
      <td width="75%"> <html:text property="remark" disabled="<%=isReadOnly%>"/></td>
    </tr>
    
	<tr bgcolor="f5f5f5"> 
      <td width="25%" valign="top"><div align="right">新闻内容<font color="#FF0000">*</font></div></td>
      <td width="75%">
      <% if (!isReadOnly) { %>
      	<html:textarea property="content" cols="60" rows="15"></html:textarea>
      <% } else { %>
      	${newsForm.content}
      <% } %>
      </td>
	</tr>
    <tr bgcolor="f5f5f5"> 
      <td colspan="2"> <div align="center"> 
          <input type="submit" name="SYS_SET" value=" 确 认 " class="frm_btn" <%=isReadOnly?"disabled=\"disabled\"":""%> >
          &nbsp;&nbsp;<input type="button" name="Button" value=" 返 回 " class="frm_btn" onclick="javascript:history.back()">
        </div></td>
    </tr>
  </table>
</html:form>

</body>
</html>